package book.shape;

/**
 * 椭圆
 */
public class Eclipse extends PlaneGraphics {
    protected double radiusA; //长轴半径
    protected double radiusB; //短轴半径

    /**
     * 椭圆
     *
     * @param radiusA 长轴半径
     * @param radiusB 短轴半径
     */
    public Eclipse(double radiusA, double radiusB) {
        super("椭圆");
        if (radiusA == radiusB) {
            this.changeShape("圆");
        }
        this.radiusA = radiusA;
        this.radiusB = radiusB;
    }

    /**
     * 圆
     *
     * @param radiusA 半径
     */
    public Eclipse(double radiusA) {
        super("圆");
        this.radiusA = radiusA;
        this.radiusB = radiusA;
    }

    /**
     * 无参数
     */
    public Eclipse() {

    }

    /**
     * 计算面积
     *
     * @return Π*长轴半径*短轴半径
     */
    public double area() {
        return Math.PI * radiusA * radiusB;
    }
}
